package headfirst.designpatterns.factory.a_cars_simplefactory2.factory;

import headfirst.designpatterns.factory.a_cars_simplefactory2.car.Benz;
import headfirst.designpatterns.factory.a_cars_simplefactory2.car.Bmw;
import headfirst.designpatterns.factory.a_cars_simplefactory2.car.Car;

/**
 * @description: 简单工厂
 * @author: 陈家盛
 * @date: 2022/6/22 10:25
 * @version: 1.0
 */
public class DriverSimplyFactory {
    public static Car createCar(String car) {
        Car c = null;
        if ("Benz".equalsIgnoreCase(car))
            c = new Benz();
        else if ("Bmw".equalsIgnoreCase(car))
            c = new Bmw();
        return c;
    }
}
